<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <h1>生命周期钩子函数</h1>
    <input type="text" v-model="val">
    <p>{{val}}</p>
  </div>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
  <!-- 2.写自己的vue代码 -->
  <script>
    let vm = new Vue({
      el: '#app',
      data: {
        val: ''
      },
      methods: {
        
      },
      beforeCreate() {
        // 实例创建前
        console.log('beforeCreate：我是第一个钩子函数');
      },
      created() {
        // 实例创建后
        console.log('created:2');
      },
      beforeMount() {
        // 页面渲染前
        console.log('beforeMount:3');
      },
      mounted() {
        // 页面渲染后
        console.log('mounted:4');
      },
      beforeUpdate() {
        // 页面更新前
        console.log('beforeUpdate:5');
      },
      updated() {
        // 页面更新后
        console.log('updated:6');
      },
      beforeDestroy() {
        // 页面销毁前
        console.log('beforeDestroy:7');
      },
      destroyed() {
        // 页面销毁后
        console.log('destroyed:8');
      },
    })
  </script>
</body>
</html>